/**
 * <copyright>
 * </copyright>
 *
 * $Id$
 */
package ch.uzh.ifi.seal.ssqa.model.impl;

import ch.uzh.ifi.seal.ssqa.model.Action;
import ch.uzh.ifi.seal.ssqa.model.ModelPackage;

import java.util.Date;

import org.eclipse.emf.common.notify.Notification;

import org.eclipse.emf.ecore.EClass;

import org.eclipse.emf.ecore.impl.ENotificationImpl;
import org.eclipse.emf.ecore.impl.EObjectImpl;

/**
 * <!-- begin-user-doc -->
 * An implementation of the model object '<em><b>Action</b></em>'.
 * <!-- end-user-doc -->
 * <p>
 * The following features are implemented:
 * <ul>
 *   <li>{@link ch.uzh.ifi.seal.ssqa.model.impl.ActionImpl#getTimestamp <em>Timestamp</em>}</li>
 *   <li>{@link ch.uzh.ifi.seal.ssqa.model.impl.ActionImpl#getOldState <em>Old State</em>}</li>
 *   <li>{@link ch.uzh.ifi.seal.ssqa.model.impl.ActionImpl#getNewState <em>New State</em>}</li>
 *   <li>{@link ch.uzh.ifi.seal.ssqa.model.impl.ActionImpl#getAction <em>Action</em>}</li>
 *   <li>{@link ch.uzh.ifi.seal.ssqa.model.impl.ActionImpl#getOriginatorId <em>Originator Id</em>}</li>
 * </ul>
 * </p>
 *
 * @generated
 */
public class ActionImpl extends EObjectImpl implements Action {
	/**
	 * The default value of the '{@link #getTimestamp() <em>Timestamp</em>}' attribute.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @see #getTimestamp()
	 * @generated
	 * @ordered
	 */
	protected static final Date TIMESTAMP_EDEFAULT = null;

	/**
	 * The cached value of the '{@link #getTimestamp() <em>Timestamp</em>}' attribute.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @see #getTimestamp()
	 * @generated
	 * @ordered
	 */
	protected Date timestamp = TIMESTAMP_EDEFAULT;

	/**
	 * The default value of the '{@link #getOldState() <em>Old State</em>}' attribute.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @see #getOldState()
	 * @generated
	 * @ordered
	 */
	protected static final String OLD_STATE_EDEFAULT = null;

	/**
	 * The cached value of the '{@link #getOldState() <em>Old State</em>}' attribute.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @see #getOldState()
	 * @generated
	 * @ordered
	 */
	protected String oldState = OLD_STATE_EDEFAULT;

	/**
	 * The default value of the '{@link #getNewState() <em>New State</em>}' attribute.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @see #getNewState()
	 * @generated
	 * @ordered
	 */
	protected static final String NEW_STATE_EDEFAULT = null;

	/**
	 * The cached value of the '{@link #getNewState() <em>New State</em>}' attribute.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @see #getNewState()
	 * @generated
	 * @ordered
	 */
	protected String newState = NEW_STATE_EDEFAULT;

	/**
	 * The default value of the '{@link #getAction() <em>Action</em>}' attribute.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @see #getAction()
	 * @generated
	 * @ordered
	 */
	protected static final String ACTION_EDEFAULT = null;

	/**
	 * The cached value of the '{@link #getAction() <em>Action</em>}' attribute.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @see #getAction()
	 * @generated
	 * @ordered
	 */
	protected String action = ACTION_EDEFAULT;

	/**
	 * The default value of the '{@link #getOriginatorId() <em>Originator Id</em>}' attribute.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @see #getOriginatorId()
	 * @generated
	 * @ordered
	 */
	protected static final String ORIGINATOR_ID_EDEFAULT = null;

	/**
	 * The cached value of the '{@link #getOriginatorId() <em>Originator Id</em>}' attribute.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @see #getOriginatorId()
	 * @generated
	 * @ordered
	 */
	protected String originatorId = ORIGINATOR_ID_EDEFAULT;

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	protected ActionImpl() {
		super();
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	@Override
	protected EClass eStaticClass() {
		return ModelPackage.Literals.ACTION;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public Date getTimestamp() {
		return timestamp;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public void setTimestamp(Date newTimestamp) {
		Date oldTimestamp = timestamp;
		timestamp = newTimestamp;
		if (eNotificationRequired())
			eNotify(new ENotificationImpl(this, Notification.SET, ModelPackage.ACTION__TIMESTAMP, oldTimestamp, timestamp));
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public String getOldState() {
		return oldState;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public void setOldState(String newOldState) {
		String oldOldState = oldState;
		oldState = newOldState;
		if (eNotificationRequired())
			eNotify(new ENotificationImpl(this, Notification.SET, ModelPackage.ACTION__OLD_STATE, oldOldState, oldState));
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public String getNewState() {
		return newState;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public void setNewState(String newNewState) {
		String oldNewState = newState;
		newState = newNewState;
		if (eNotificationRequired())
			eNotify(new ENotificationImpl(this, Notification.SET, ModelPackage.ACTION__NEW_STATE, oldNewState, newState));
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public String getAction() {
		return action;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public void setAction(String newAction) {
		String oldAction = action;
		action = newAction;
		if (eNotificationRequired())
			eNotify(new ENotificationImpl(this, Notification.SET, ModelPackage.ACTION__ACTION, oldAction, action));
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public String getOriginatorId() {
		return originatorId;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public void setOriginatorId(String newOriginatorId) {
		String oldOriginatorId = originatorId;
		originatorId = newOriginatorId;
		if (eNotificationRequired())
			eNotify(new ENotificationImpl(this, Notification.SET, ModelPackage.ACTION__ORIGINATOR_ID, oldOriginatorId, originatorId));
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	@Override
	public Object eGet(int featureID, boolean resolve, boolean coreType) {
		switch (featureID) {
			case ModelPackage.ACTION__TIMESTAMP:
				return getTimestamp();
			case ModelPackage.ACTION__OLD_STATE:
				return getOldState();
			case ModelPackage.ACTION__NEW_STATE:
				return getNewState();
			case ModelPackage.ACTION__ACTION:
				return getAction();
			case ModelPackage.ACTION__ORIGINATOR_ID:
				return getOriginatorId();
		}
		return super.eGet(featureID, resolve, coreType);
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	@Override
	public void eSet(int featureID, Object newValue) {
		switch (featureID) {
			case ModelPackage.ACTION__TIMESTAMP:
				setTimestamp((Date)newValue);
				return;
			case ModelPackage.ACTION__OLD_STATE:
				setOldState((String)newValue);
				return;
			case ModelPackage.ACTION__NEW_STATE:
				setNewState((String)newValue);
				return;
			case ModelPackage.ACTION__ACTION:
				setAction((String)newValue);
				return;
			case ModelPackage.ACTION__ORIGINATOR_ID:
				setOriginatorId((String)newValue);
				return;
		}
		super.eSet(featureID, newValue);
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	@Override
	public void eUnset(int featureID) {
		switch (featureID) {
			case ModelPackage.ACTION__TIMESTAMP:
				setTimestamp(TIMESTAMP_EDEFAULT);
				return;
			case ModelPackage.ACTION__OLD_STATE:
				setOldState(OLD_STATE_EDEFAULT);
				return;
			case ModelPackage.ACTION__NEW_STATE:
				setNewState(NEW_STATE_EDEFAULT);
				return;
			case ModelPackage.ACTION__ACTION:
				setAction(ACTION_EDEFAULT);
				return;
			case ModelPackage.ACTION__ORIGINATOR_ID:
				setOriginatorId(ORIGINATOR_ID_EDEFAULT);
				return;
		}
		super.eUnset(featureID);
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	@Override
	public boolean eIsSet(int featureID) {
		switch (featureID) {
			case ModelPackage.ACTION__TIMESTAMP:
				return TIMESTAMP_EDEFAULT == null ? timestamp != null : !TIMESTAMP_EDEFAULT.equals(timestamp);
			case ModelPackage.ACTION__OLD_STATE:
				return OLD_STATE_EDEFAULT == null ? oldState != null : !OLD_STATE_EDEFAULT.equals(oldState);
			case ModelPackage.ACTION__NEW_STATE:
				return NEW_STATE_EDEFAULT == null ? newState != null : !NEW_STATE_EDEFAULT.equals(newState);
			case ModelPackage.ACTION__ACTION:
				return ACTION_EDEFAULT == null ? action != null : !ACTION_EDEFAULT.equals(action);
			case ModelPackage.ACTION__ORIGINATOR_ID:
				return ORIGINATOR_ID_EDEFAULT == null ? originatorId != null : !ORIGINATOR_ID_EDEFAULT.equals(originatorId);
		}
		return super.eIsSet(featureID);
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	@Override
	public String toString() {
		if (eIsProxy()) return super.toString();

		StringBuffer result = new StringBuffer(super.toString());
		result.append(" (timestamp: ");
		result.append(timestamp);
		result.append(", oldState: ");
		result.append(oldState);
		result.append(", newState: ");
		result.append(newState);
		result.append(", action: ");
		result.append(action);
		result.append(", originatorId: ");
		result.append(originatorId);
		result.append(')');
		return result.toString();
	}

} //ActionImpl
